package cn.com.eado.crm.m.db

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import cn.com.eado.crm.m.db.Account


@Dao
interface AccountDao {
    @Insert//(onConflict = OnConflictStrategy.REPLACE)
    fun insert(account: Account)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun replaceAll(accounts: List<Account>)

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun replace(account: Account)

    @Update
    fun update(account: Account)

    @Query("select * from account where name = :name")  //查询所有
    fun queryWithName(name: String): Account?

    @Query("select * from account")  //查询所有
    fun query(): List<Account>
}